package com.isp.org.api.enums;

import java.util.Arrays;

/**
 * @author linsy
 * @version 1.0
 * @created 2024/1/26 10:46
 */
public enum MenuTypeEnums {
    DIRECTORY(0, "目录"),
    MENU(1, "菜单"),
    BUTTON(2, "按钮");

    private final Integer code;
    private final String name;

    public static MenuTypeEnums getByCode(Integer code) {
        return Arrays.stream(MenuTypeEnums.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }

    MenuTypeEnums(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }
}
